<template>
	<gui-page ref="guiPage" :customHeader="true">
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('distributedEnter.scanRecord')"></nav-bar-custom>
		</template>
		<template v-slot:gBody>
			<view v-if="scanList.length==0" class="noticeHooks">
				{{scanList.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without')}}
			</view>
			<view class="record-card" v-for="(simpleList,index) in scanList" :key="index" v-else>
				<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30" @click="deletList(index,simpleList)"></uni-icons>
				<view class="card-mini-head">
					<view class="title-line"></view>
					<text>{{$t('translationImage.serialNumber')}}：</text>{{index+1}}
				</view> 
				<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedEnter.materialCoded')}}：</text>{{simpleList.barcode}}
				</view>
				<view class="custom-card-itemOne">
					<view class="card-item-50">
						<text class="item-info-title">{{$t('distributedEnter.materialCode')}}：</text>{{simpleList.materialCode}}
					</view>
					<view class="card-item-50">
						<text class="item-info-title">{{$t('distributedEnter.materialName')}}：</text>{{simpleList.materialName}}
					</view>
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialSpec')}}：</text>{{simpleList.materialSpec}}
				</view>
				<view class="custom-card-itemOne">
					<view class="card-item-50">
						<text class="item-info-title">{{$t('distributedEnter.uom')}}：</text>{{simpleList.unit}}
					</view>
					<view class="card-item-50">
						<text class="item-info-title">{{$t('distributedEnter.qty')}}：</text>{{simpleList.currentQty}}
					</view>	
				</view>
				
			</view>
		</template>
	</gui-page>
</template>

<script setup>
// 引入文件
import {computed,onMounted} from 'vue';
import { useStore } from "vuex";
import { basPdaOperationLogFn } from '@/utils/index.js';
import { OPERATION_DEL, OPERATION_LOOK } from '@/constant/index.js'

// 定义vuex的变量获取数据
let store = useStore();

// 通过计算属性获取数据
const scanList = computed(()=>{
	console.log(store.state.simpleWarehousingList,'data.scanList')
	return store.state.simpleWarehousingList
})
onMounted(()=>{
	console.log(scanList.value)
	try {
		let inputParameter = '无'
		let returnParameter = JSON.stringify(scanList.value)
		let operationPicture = '简单生产入库'
		let callInterface = '无'
		let opertionParmes = {
			inputParameter,
			returnParameter,
			operationPicture,
			callInterface,
			responseCode:'无',//返回状态
			errorMessage:'无',//错误信息
			isPass:'Y',//是否成功 Y N
			operationType:OPERATION_LOOK
		}
		basPdaOperationLogFn(opertionParmes)
	} catch (error) {
	}
})
// 删除 (先在vuex定义方法,在使用)
const deletList=(index,item)=>{
	try {
		let inputParameter = '无'
		let returnParameter = JSON.stringify(item)
		let operationPicture = '简单生产入库'
		let callInterface = '无'
		let opertionParmes = {
			inputParameter,
			returnParameter,
			operationPicture,
			callInterface,
			responseCode:'无',//返回状态
			errorMessage:'无',//错误信息
			isPass:'Y',//是否成功 Y N
			operationType:OPERATION_DEL
		}
		basPdaOperationLogFn(opertionParmes)
	} catch (error) {
	}
	store.commit("deletesimpleWarehousingList",index)
}
</script>

<style>

</style>
